package com.lz.springboot.apollo.rabbit;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SimpleSender{

    @Autowired
    private RabbitTemplate rabbitTemplate;
	
	
	public void send(String message){
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
		String context = message + "_" + sdf.format(new Date());
		//System.out.println("SimpleSender1=" + context);
		CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
		this.rabbitTemplate.convertAndSend(RabbitConfig.SPRINGBOOT_RABBIT_SIMPLE_QUEUE, context);
	}

}
